package com.example.pet.fragment;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class FragmentFactory extends FragmentStateAdapter {

    public FragmentFactory(@NonNull FragmentActivity fa){
        super(fa);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch (position){
            case 0:
                return new ContentFragment();
            case 1:
                return new Myself_fragment();
            default:
                throw new IllegalStateException("Unexpected position:" + position);
        }
    }




    @Override
    public int getItemCount() {
        return 2;
    }
}
